package parsers.tests;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import parsers.CSVParser;
import junit.framework.Assert;
import junit.framework.TestCase;

public class URLTests extends TestCase
{
    private CSVParser myParser;

    protected void setUp() throws Exception
    {
        super.setUp();
        myParser = new CSVParser();
    }

    protected void tearDown() throws Exception
    {
        super.tearDown();
    }

    public void testParseURL()
    {
        URL path = null;
        try
        {
            path = new URL("http://www.duke.edu/~vr28/2DTestData.csv");
        }
        catch (MalformedURLException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        List<List<String>> result = myParser.parseURL(path);
        Assert.assertEquals(5, result.size());
        Assert.assertEquals(2, result.get(0).size());
        Assert.assertEquals("steve", result.get(2).get(0));
        Assert.assertEquals("6.0", result.get(3).get(1));
        Assert.assertEquals("Delilah", result.get(4).get(0));
    }

}
